package com.zmn.plat.common.dictionary;

/**
 * 渠道类型
 *
 * @author xiangjunming
 * @since 2019 /08/20 14:47:16
 */
@Deprecated
public enum ChannelReceivablesEnum {

    /**
     * values
     */
    GCS(1, "工程师收款"),
    PT(2, "平台收款"),
    QD(3, "渠道收款"),
    FWS(4, "服务商收款"),
    ;

    private Integer code;
    private String name;

    ChannelReceivablesEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static ChannelReceivablesEnum of(Integer code) {
        if (code == null) {
            return null;
        }
        switch (code) {
            case 1:
                return GCS;
            case 2:
                return PT;
            case 3:
                return QD;
            case 4:
                return FWS;
            default:
                return null;
        }
    }

    public static String getName(Integer code) {
        ChannelReceivablesEnum of = of(code);
        return of == null ? null : of.getName();
    }

    public static ChannelReceivablesEnum[] enables() {
        return new ChannelReceivablesEnum[]{GCS, PT, QD, FWS};
    }
}
